package com.ceres.crops.dao;

import com.ceres.crops.pojo.Pest;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface PestMapper extends Mapper<Pest> {
    @Select("select * from t_pest where id in (select pid from t_crops_disease where cid=#{id})")
    List<Pest> findPestByCid(Integer id);

    @Update("update t_crops_disease set status= 0 where cid in (select id from t_crops where name=#{name})")
    void delByName(String name);
}
